﻿using Abp.Application.Services.Dto;

namespace Basefr.App.Messages
{
    public interface IInput
    {
    }

    /// <summary>
    /// 获取对象request基类
    /// </summary>
    public class QueryInput<TPrimaryKey> : ISortedResultRequest, IInput
    {
        public TPrimaryKey Id { get; set; }
        public string Sorting { get; set; }
    }
    public class QueryInput : QueryInput<int>
    {

    }


    /// <summary>
    /// 分页请求Request
    /// </summary>
    public class QueryPagedInput : PagedAndSortedResultRequestDto, IInput
    {
        public bool QueryAll
        {
            set
            {
                if (value)
                {
                    SkipCount = 0;
                    MaxResultCount = 2000;
                    Sorting = "Id ASC";
                }
            }
        }
    }


    /// <summary>
    /// 保存对象request基类
    /// </summary>
    public class SaveInput<T, TPrimaryKey> : IInput
        where T : IEntityDto<TPrimaryKey>
        where TPrimaryKey : struct
    {
        public virtual T Item { get; set; }
    }
    public class SaveInput<T> : SaveInput<T, int>
        where T : IEntityDto
    {

    }


    /// <summary>
    /// 保存列表request基类
    /// </summary>
    public class SaveListInput<T, TPrimaryKey> : ListResultDto<T>, IInput
        where T : IEntityDto<TPrimaryKey>
        where TPrimaryKey : struct
    {

    }
    public class SaveListInput<T> : SaveListInput<T, int>
        where T : IEntityDto
    {
    }


    /// <summary>
    /// 删除对象request基类
    /// </summary>
    public class DeleteInput<TPrimaryKey> : EntityDto<TPrimaryKey>, IInput
    {

    }
    public class DeleteInput : DeleteInput<int>
    {

    }

}
